import 'package:flutter/material.dart';
import 'package:flutter_application_2/pages/home/tab_index/index_recommond_item_widget.dart';
import './index_recommond_data.dart';

class IndexRecommond extends StatelessWidget {
  final List<IndexRecommendItem> dataList;

  const IndexRecommond({Key key, this.dataList = indexRecommendData})
      : super(key: key);
  @override
  Widget build(BuildContext context) {
    return Container(
      padding: EdgeInsets.all(10.0),
      decoration: BoxDecoration(color: Colors.grey[300]),
      child: Column(
        children: [
          Padding(padding: EdgeInsets.all(5.0)),
          Row(
            mainAxisAlignment: MainAxisAlignment.spaceBetween,
            children: [
              Text(
                '房屋推荐',
                style: TextStyle(fontWeight: FontWeight.w600),
              ),
              Text('更多')
            ],
          ),
          Padding(padding: EdgeInsets.all(5.0)),
          Wrap(
            runSpacing: 10.0,
            spacing: 10.0,
            children: dataList
                .map(
                  (item) => IndexRecommondItemWidget(item),
                )
                .toList(),
          ),
          Padding(padding: EdgeInsets.all(5.0)),
        ],
      ),
    );
  }
}
